Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#167730641 Notifying New Travel Request #20

Open
wants to merge 27 commits into
base: develop
Choose a base branch
from

Conversation

ChidiChuks
Copy link
Collaborator

@ChidiChuks ChidiChuks commented Sep 3, 2019

What does this PR do?

Have a notification created on Barefoot Nomad upon a user making a new travel request

Description of Task to be completed?

There will be two forms of notification to be implemented which are;

  • The push notification
  • The email notification
  • Create a notifications table
  • Install dependencies socket.io and auto-bind
  • Prepare the server
  • Set-up the project
  • Display New travel Requests
  • Add Notifications
  • Send Push and Email Notifications

How should this be manually tested?

Any background context you want to provide?

What are the relevant pivotal tracker stories?

#167730641

Screenshots (if appropriate)

image

image

image

Questions:

@ChidiChuks ChidiChuks added question Further information is requested help wanted Extra attention is needed labels Sep 3, 2019
@ChidiChuks ChidiChuks changed the title #167730641 Notifying New Travel Request #167730641 Notifying New Travel Request [WIP} Sep 3, 2019
@ChidiChuks ChidiChuks changed the title #167730641 Notifying New Travel Request [WIP} #167730641 Notifying New Travel Request [WIP] Sep 3, 2019
@ChidiChuks ChidiChuks changed the title #167730641 Notifying New Travel Request [WIP] Notifying New Travel Request [WIP] Sep 3, 2019
@ChidiChuks ChidiChuks changed the title Notifying New Travel Request [WIP] [WIP] Notifying New Travel Request Sep 3, 2019
@chuksjoe
Copy link
Collaborator

chuksjoe commented Sep 3, 2019

What is the issue you having here bro @ChidiChuks ?

], {});
},

down: (queryInterface, Sequelize) => {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'Sequelize' is defined but never used no-unused-vars

@@ -0,0 +1,23 @@
module.exports = {
up: (queryInterface, Sequelize) => {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'Sequelize' is defined but never used no-unused-vars

@@ -0,0 +1,23 @@
module.exports = {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'module' is not defined no-undef

@@ -0,0 +1,13 @@
module.exports = (sequelize, DataTypes) => {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'module' is not defined no-undef

}
});
},
down: (queryInterface, Sequelize) => {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'Sequelize' is defined but never used no-unused-vars

@@ -0,0 +1,29 @@
module.exports = {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'module' is not defined no-undef

@ChidiChuks
Copy link
Collaborator Author

What is the issue you having here bro @ChidiChuks ?

Thanks alot for this. I'm really trying to decide on which service worker would work properly on the app for the in-app notification. I'm contemplating between socket.io and web-push. But I think after my research and all I finally understood socket.io more and its' advantage

@@ -0,0 +1,5 @@
import { Router } from 'express';
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Parsing error: 'import' and 'export' may appear only with 'sourceType: module'

manager_email: DataTypes.TEXT
}, {});

departments.associate = (models) => {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'models' is defined but never used no-unused-vars

@@ -0,0 +1,17 @@
module.exports = (sequelize, DataTypes) => {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'module' is not defined no-undef

@@ -0,0 +1,18 @@
export default {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Parsing error: 'import' and 'export' may appear only with 'sourceType: module'

@@ -0,0 +1,48 @@
import Model from '../database/models';
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Parsing error: 'import' and 'export' may appear only with 'sourceType: module'

@ChidiChuks ChidiChuks removed help wanted Extra attention is needed question Further information is requested labels Sep 6, 2019
@@ -0,0 +1,13 @@
import { io } from '../index';
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Parsing error: 'import' and 'export' may appear only with 'sourceType: module'

* @returns {Object} the new user
* @description register a new client
*/
static async getProfile(req, res) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Parsing error: Unexpected token getProfile

/* eslint-disable import/named */
/* eslint-disable require-jsdoc */

import models from '../models';
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Parsing error: 'import' and 'export' may appear only with 'sourceType: module'

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ChidiChuks Nice work

please what does this do?

we cannot but include html?

it('should return an error if the token is invalid', (done) => {
chai.request(app)
.post(`${prefix}/auth/logout`)
.set("Authorization", "Bearer hjgvju")
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Strings must use singlequote quotes

token = data.token;
done();
});
})
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing semicolon semi

.send(testuser)
.end((err, res) => {
const { data } = res.body;
token = data.token;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use object destructuring prefer-destructuring

});
});

it('should contain a token value in its response data object', (done) => {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Block must not be padded by blank lines padded-blocks

});
});

it('should authenticate a user with a valid email and password', (done) => {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Block must not be padded by blank lines padded-blocks

@@ -0,0 +1,5 @@
import { io } from '..';

export const eventEmitter = (eventName, data) => {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer default export import/prefer-default-export

const foo = (io = null) => {
router.use('/auth', auth);
router.get('/profile/:user_id', getProfile);
router.use('/request', checkToken, requestRouter(io));
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'checkToken' is not defined no-undef
'requestRouter' is not defined no-undef


const { getProfile } = profileController;

const router = express.Router();
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'express' is not defined no-undef

});
}
};
};
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Newline required at end of file but not found eol-last

down: (queryInterface, Sequelize) => {
return queryInterface.bulkDelete('notifications', null, {});
}
};
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Newline required at end of file but not found eol-last

const travelObj = { user_id:userId, origin, destination, departure_date, travel_purpose };

const travelObj = { user_id: userId, origin, destination, departure_date, travel_purpose };
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected a line break after this opening brace object-curly-newline
Expected a line break before this closing brace object-curly-newline
Line 17 exceeds the maximum line length of 100 max-len

@@ -1,3 +1,5 @@
import autoBind from 'auto-bind';
import notifyServices from '../services/websocket'
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'notifyServices' is defined but never used no-unused-vars
Missing semicolon semi

@@ -1,3 +1,5 @@
import autoBind from 'auto-bind';
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'autoBind' is defined but never used no-unused-vars

sendPasswordResetEmail,
receiveNewPassword
}

}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing semicolon semi

})

.catch(() => {
res.status(404).json("Invalid user")
res.status(404).json("Invalid user")
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing semicolon semi
Strings must use singlequote quotes

const payload = jwt.decode(token, secret)
if (payload.userId === user.id) {
bcrypt.genSalt(10, function(err, salt) {
if (err) return
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing semicolon semi

const secret = user.password + "-" + user.createdAt
const payload = jwt.decode(token, secret)
if (payload.userId === user.id) {
bcrypt.genSalt(10, function(err, salt) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing space before function parentheses space-before-function-paren
Unexpected function expression prefer-arrow-callback
Unexpected unnamed function func-names

})
}
const secret = user.password + "-" + user.createdAt
const payload = jwt.decode(token, secret)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing semicolon semi

})
})
}
const secret = user.password + "-" + user.createdAt
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing semicolon semi
Strings must use singlequote quotes
Unexpected string concatenation prefer-template

const { password } = req.body
const receiveNewPassword = (req, res) => {
const { userId, token } = req.params
const { password } = req.body
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing semicolon semi

updatedAt: new Date(),
},
], {}
),
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unexpected newline before ')' function-paren-newline

@@ -0,0 +1,23 @@
module.exports = {
up: (queryInterface) => queryInterface.bulkInsert(
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unexpected newline after '(' function-paren-newline

app.use(prefix, travel);
app.use(prefix, comment);
app.use(prefix, notify);
};
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Newline required at end of file but not found eol-last

};

return departments;
};
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Newline required at end of file but not found eol-last

manager_email: DataTypes.TEXT
}, {});

departments.associate = (models) => {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'models' is defined but never used no-unused-vars

const { userId, token } = req.params
const { password } = req.body
const receiveNewPassword = (req, res) => {
const { userId, token } = req.params
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing semicolon semi

const token = usePasswordHashToMakeToken(user)
const url = getPasswordResetURL(user, token)
const emailTemplate = resetPasswordTemplate(user, url)
transporter(emailTemplate, res)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing semicolon semi

}
const token = usePasswordHashToMakeToken(user)
const url = getPasswordResetURL(user, token)
const emailTemplate = resetPasswordTemplate(user, url)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing semicolon semi

res.status(404).json("No user with that email")
}
const token = usePasswordHashToMakeToken(user)
const url = getPasswordResetURL(user, token)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing semicolon semi

} catch (err) {
res.status(404).json("No user with that email")
}
const token = usePasswordHashToMakeToken(user)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing semicolon semi

],
welcome: 'Welcome to Archangel Barefoot Nomad Web App API.',
signupSuccess: (email) => `You have successfully registered with this email, ${email}.`,
verificationMessage: (hostUrl) => Click on this link to verify your email $ { url },
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Parsing error: Unexpected token, expected ","

module.exports = foo;


export default router;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Newline required at end of file but not found eol-last

const foo = (io = null) => {
router.use('/auth', auth);
router.get('/profile/:user_id', getProfile);
router.use('/request', getToken, verifyToken, requestRouter(io));
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'requestRouter' is not defined no-undef



const foo = (io = null) => {
router.use('/auth', auth);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'auth' is not defined no-undef

try {
user = await queryByEmail(email)
} catch (err) {
res.status(404).json("No user with that email")
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing semicolon semi
Strings must use singlequote quotes

authControllers
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unexpected line break before this closing brace object-curly-newline

errorResponse(res, statusCode.serverError, err.message);
}
},
};
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Newline required at end of file but not found eol-last

}
},
};
logout: async(req, res) => {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing space before function parentheses space-before-function-paren

} else {
const token = generateToken(data.id, email, data.role, data.first_name);
return successResponseWithData(res, statusCode.success, message.loginSuccess, {...data, token });
};
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unnecessary semicolon no-extra-semi
Unreachable code no-unreachable

throw new ApiErrors(message.incorrectPassword, statusCode.badRequest);
} else {
const token = generateToken(data.id, email, data.role, data.first_name);
return successResponseWithData(res, statusCode.success, message.loginSuccess, {...data, token });
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A space is required after '{' object-curly-spacing
Line 78 exceeds the maximum line length of 100 max-len

};
export default sendVerificationEmail;
};
export default sendVerificationEmail;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Newline required at end of file but not found eol-last

password: 'every125',
dept_id: 15327458,
role: 'line_manager'
};
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Newline required at end of file but not found eol-last

throw err;
}
},
};
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Newline required at end of file but not found eol-last

throw err;
}
},
findTravelById: async(id) => {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing space before function parentheses space-before-function-paren

}
},
};
oneWayTripService: async(travelObj) => {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing space before function parentheses space-before-function-paren

try{
return await users.update(hash, { where: { id } });
}catch(err){
const updatePassword = async(hash, id) => {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing space before function parentheses space-before-function-paren

try {
return await users.findOne({ where: { id } });
} catch (err) {
throw err
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing semicolon semi

* @param {String} id - user's id
* @returns {Promise} - sequelize response
*/
const queryById = async(id) => {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing space before function parentheses space-before-function-paren

} catch (err) {
throw err;
}
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing semicolon semi

}catch(err){
throw err
}
const queryByEmail = async(email) => {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing space before function parentheses space-before-function-paren

notFound: 404,
unauthorized: 401,
serverError: 500
};
};
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Newline required at end of file but not found eol-last

first_name,
last_name
} = userDetails;
const { destination, departure_date, return_date } => {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Parsing error: Unexpected token

invalidTravelId: 'The travel ID must be an integer value.',
nonExistentTravel: 'The travel request does not exist.',
emptyComment: 'comment cannot be empty.',
};
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Newline required at end of file but not found eol-last

} catch (err) {
throw err
}
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing semicolon semi
Newline required at end of file but not found eol-last

try {
return await users.update(hash, { where: { id } });
} catch (err) {
throw err
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing semicolon semi

} catch (err) {
throw err;
}
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing semicolon semi

* @param {String} email - line-manager's email
* @returns {Promise} - sequelize response
*/
export const findManagerByEmail = async(email) => {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing space before function parentheses space-before-function-paren

try {
return await blacklists.create({ expired_tokens: token })
} catch (err) {
throw err;
}
}

};
};
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Newline required at end of file but not found eol-last

comparePassword: (password, hashedPassword) => compareSync(password, hashedPassword),

logoutService: async (token) => {
logoutService: async(token) => {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing space before function parentheses space-before-function-paren

} catch (err) {
throw err;
}
updateUserById: async(hash, id) => {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing space before function parentheses space-before-function-paren

},
], {}),

down: (queryInterface, Sequelize) => queryInterface.bulkDelete('notifications', null, {})
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'Sequelize' is defined but never used no-unused-vars

} catch (err) {
throw err;
}
findUserById: async(id) => {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Duplicate key 'findUserById' no-dupe-keys
Missing space before function parentheses space-before-function-paren

@@ -8,13 +8,13 @@ import sendVerificationEmail from '../utils/email';
const { users, blacklists } = models;

export default {
signupService: async (userObj) => {
signupService: async(userObj) => {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing space before function parentheses space-before-function-paren

@@ -12,4 +12,4 @@ const { getToken, verifyToken } = authUtils;
// handles the api home route...
route.post('/onewaytrip', getToken, verifyToken, validateTravelRequest, validateResult, createOneWayTrip);

export default route;
export default route;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Newline required at end of file but not found eol-last

passport.authenticate('google', {
failureRedirect: '/auth/signup',
successRedirect: '/requests',
}));
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected a newline before ')' function-paren-newline

type: Sequelize.DATE,
}
}),
down: (queryInterface, Sequelize) => queryInterface.dropTable('users')
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'Sequelize' is defined but never used no-unused-vars

type: Sequelize.DATE
}
}),
down: (queryInterface, Sequelize) => queryInterface.dropTable('departments')
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'Sequelize' is defined but never used no-unused-vars

const data = await oneWayTripService(travelObj);

const emailVerify = await sendVerificationEmail(email,
'Travel Confirmation', message.notifyUser);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected a newline before ')' function-paren-newline


const data = await oneWayTripService(travelObj);

const emailVerify = await sendVerificationEmail(email,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'emailVerify' is assigned a value but never used no-unused-vars
Expected a newline after '(' function-paren-newline

}
};

export const readAllNotification = async(req, res) => {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing space before function parentheses space-before-function-paren

@ChidiChuks ChidiChuks requested a review from chuksjoe September 13, 2019 17:05
});
} catch (error) {
throw error;
}
};

export const approveTravel = async (id) => {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Parsing error: approveTravel has already been exported. Exported identifiers must be unique.

- The push notification
- The email notification
Create a notifications table
Install dependencies socket.io and auto-bind
Prepare the server
Set-up the project
Display New travel Requests
Add Notifications
Send Push and Email Notifications
[Finishes: #167730641]
- The push notification
- The email notification
Create a notifications table
Install dependencies socket.io and auto-bind
Prepare the server
Set-up the project
Display New travel Requests
Add Notifications
Send Push and Email Notifications
[Finishes: #167730641]
done();
});
});
before((done) => {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected indentation of 2 spaces but found 4 indent

managerToken1 = data.token;
done();
});
});
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected indentation of 2 spaces but found 4 indent

const { data } = res.body;
managerToken1 = data.token;
done();
});
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected indentation of 6 spaces but found 12 indent

.end((err, res) => {
const { data } = res.body;
managerToken1 = data.token;
done();
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected indentation of 8 spaces but found 16 indent

.send(testManager1)
.end((err, res) => {
const { data } = res.body;
managerToken1 = data.token;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected indentation of 8 spaces but found 16 indent

done();
});
});
before((done) => {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected indentation of 2 spaces but found 4 indent

});

describe('Testing the travel approval route', () => {
let managerToken1, managerToken2;
let managerToken1, managerToken2;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected indentation of 2 spaces but found 4 indent

expect(res).to.have.status(401);
done();
});
});
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected indentation of 2 spaces but found 4 indent

.end((err, res) => {
expect(res).to.have.status(401);
done();
});
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected indentation of 6 spaces but found 12 indent

.set('Authorization', adminToken)
.end((err, res) => {
expect(res).to.have.status(401);
done();
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected indentation of 8 spaces but found 16 indent

Copy link
Collaborator

@chuksjoe chuksjoe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well done bro @ChidiChuks. But I don't know how your implementation sends out the notification when a requester makes a travel request.
The Notification is meant to be sent when the request is created, but you didn't add any logic that sends it in the controller function that creates the request.

@ChidiChuks
Copy link
Collaborator Author

ChidiChuks commented Sep 13, 2019

Well done bro @ChidiChuks. But I don't know how your implementation sends out the notification when a requester makes a travel request.
The Notification is meant to be sent when the request is created, but you didn't add any logic that sends it in the controller function that creates the request.

Oh. bro @chuksjoe that should have been missed out while I was resolving the conflicts. But in the meantime thanks for your observation. It has been included and a screenshot of it is above

- The push notification
- The email notification
- Create a notifications table
- Install dependencies socket.io and auto-bind
- Prepare the server
- Set-up the project
- Display New travel Requests
- Add Notifications
- Send Push and Email Notifications
[Finishes: #167730641]
verifyToken,
verifyRole('manager'),
verifyDeptManagerAndRequestStatus,
approveTravelRequest,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected indentation of 2 spaces but found 4 indent

getToken,
verifyToken,
verifyRole('manager'),
verifyDeptManagerAndRequestStatus,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected indentation of 2 spaces but found 4 indent

'/travel/approve_request/:travel_id',
getToken,
verifyToken,
verifyRole('manager'),
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected indentation of 2 spaces but found 4 indent

approveTravelRequest,
'/travel/approve_request/:travel_id',
getToken,
verifyToken,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected indentation of 2 spaces but found 4 indent

verifyDeptManagerAndRequestStatus,
approveTravelRequest,
'/travel/approve_request/:travel_id',
getToken,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected indentation of 2 spaces but found 4 indent

pendingManagerApproval,
getUserTravelStatus,
approveTravelRequest,
createOneWayTrip,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected indentation of 2 spaces but found 4 indent

.request(app)
.post(onewayRoute)
.set('Authorization', token)
.send(mutatedtravelRequest)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected indentation of 6 spaces but found 12 indent

chai
.request(app)
.post(onewayRoute)
.set('Authorization', token)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected indentation of 6 spaces but found 12 indent

});
chai
.request(app)
.post(onewayRoute)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected indentation of 6 spaces but found 12 indent

});
});
chai
.request(app)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected indentation of 6 spaces but found 12 indent

Copy link
Collaborator

@danoseun danoseun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't see the logic that sends out the notification. Maybe you omitted it @ChidiChuks

- The push notification
- The email notification
- Create a notifications table
- Install dependencies socket.io and auto-bind
- Prepare the server
- Set-up the project
- Display New travel Requests
- Add Notifications
- Send Push and Email Notifications
[Finishes: #167730641]
expect(res).to.have.status(401);
done();
});
});
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected indentation of 2 spaces but found 4 indent

.end((err, res) => {
expect(res).to.have.status(401);
done();
});
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected indentation of 6 spaces but found 12 indent

.set('Authorization', token)
.end((err, res) => {
expect(res).to.have.status(401);
done();
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected indentation of 8 spaces but found 16 indent

.patch(approveRequestRoute)
.set('Authorization', token)
.end((err, res) => {
expect(res).to.have.status(401);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected indentation of 8 spaces but found 16 indent

.request(app)
.patch(approveRequestRoute)
.set('Authorization', token)
.end((err, res) => {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected indentation of 6 spaces but found 12 indent

.end((err, res) => {
expect(res).to.have.status(401);
done();
});
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected indentation of 6 spaces but found 12 indent

.set('Authorization', managerToken1)
.end((err, res) => {
expect(res).to.have.status(401);
done();
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected indentation of 8 spaces but found 16 indent

.patch(approveRequestRoute)
.set('Authorization', managerToken1)
.end((err, res) => {
expect(res).to.have.status(401);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected indentation of 8 spaces but found 16 indent

.request(app)
.patch(approveRequestRoute)
.set('Authorization', managerToken1)
.end((err, res) => {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected indentation of 6 spaces but found 12 indent

chai
.request(app)
.patch(approveRequestRoute)
.set('Authorization', managerToken1)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected indentation of 6 spaces but found 12 indent

Copy link
Collaborator

@chuksjoe chuksjoe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well done brother @ChidiChuks.
Please attend to the inline comments I dropped and to the Hound-CI violation flags.


const emailVerify = await sendVerificationEmail(email,
'Travel Confirmation', message.notifyUser);
emission('here', 'we made it');
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, what message are you emitting here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, what message are you emitting here?

That was me testing the feature however it haas been updated

@@ -1,28 +1,21 @@
import { Router } from 'express';
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You did not add a line of code in this file. Please, revert the changes.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ChidiChuks please tidy up the commented lines

@@ -6,85 +6,64 @@ import models from '../models';

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You did not add a line of code in this file. Please, revert changes.

@@ -5,11 +5,11 @@ import dotenv from 'dotenv';

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You did not add a line of code on this file. Please, revert changes.

try {
const user_id = req.users.id;
const allRequests = await notifications.findAll({ where: { receiver: user_id } });
return res.status(200).json({ status: 200, data: allRequests });
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thought we have a function that handles responses (successResponseWithDatat and errorResppnse). Why use return res...?

},

readAllNotification: async (req, res) => {
try {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ChidiChuks You really put in a lot of efforts into this

Are you supposed to implement this function readAllNotification? because there is a task on the PT that has to do with reading notifications

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ChidiChuks You really put in a lot of efforts into this

Are you supposed to implement this function readAllNotification? because there is a task on the PT that has to do with reading notifications

Oh yes, I had to do this to be able to test the algorithm and see that the notification is working

Copy link
Collaborator

@Kaytbode Kaytbode left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ChidiChuks You have really done a great job with the implementation of this feature, and i understand how stressful it could be spending so much time, on a task.

I left some questions for you while going through the code. Please your response is needed mainly as a form of clarity.

.isEmpty()
.withMessage(message.emptyAccommodation)
.isInt()
.withMessage(message.isNotInteger)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected indentation of 4 spaces but found 2 indent

.not()
.isEmpty()
.withMessage(message.emptyAccommodation)
.isInt()
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected indentation of 4 spaces but found 2 indent

check('accommodation_id')
.not()
.isEmpty()
.withMessage(message.emptyAccommodation)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected indentation of 4 spaces but found 2 indent

.withMessage(message.emptyTravelPurpose),
check('accommodation_id')
.not()
.isEmpty()
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected indentation of 4 spaces but found 2 indent

.isEmpty()
.withMessage(message.emptyTravelPurpose),
check('accommodation_id')
.not()
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected indentation of 4 spaces but found 2 indent

check('return_date')
.not()
.isEmpty()
.withMessage(message.emptyReturnDate)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected indentation of 4 spaces but found 2 indent

.bail(),
check('return_date')
.not()
.isEmpty()
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected indentation of 4 spaces but found 2 indent

.withMessage(message.isNotISODate)
.bail(),
check('return_date')
.not()
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected indentation of 4 spaces but found 2 indent

.withMessage(message.emptyDepartureDate)
.isISO8601()
.withMessage(message.isNotISODate)
.bail(),
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected indentation of 4 spaces but found 2 indent

.isEmpty()
.withMessage(message.emptyDepartureDate)
.isISO8601()
.withMessage(message.isNotISODate)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected indentation of 4 spaces but found 2 indent

@ChidiChuks ChidiChuks force-pushed the ft-notify-new-travel-167730641 branch from 2d05eaa to 07d0a3d Compare September 14, 2019 22:16
userEmailNotFound: (email) => `Sorry, there is no user with email ${email} in the database.`,
userIdNotFound: (id) => `Sorry, there is no user with id: ${id} in the database.`,
unregisteredEmail: (email) => `User with this email (${email}) not found in our database.`,
wrongRole: (role) => `Sorry, you are not a/an ${role}.`,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected indentation of 2 spaces but found 4 indent

successfullyApproval: (requester) => `You have successfully approved a travel request from ${requester}.`,
userEmailNotFound: (email) => `Sorry, there is no user with email ${email} in the database.`,
userIdNotFound: (id) => `Sorry, there is no user with id: ${id} in the database.`,
unregisteredEmail: (email) => `User with this email (${email}) not found in our database.`,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected indentation of 2 spaces but found 4 indent

unauthorizedCommentDelete: "comment can only be deleted by it's author",
successfullyApproval: (requester) => `You have successfully approved a travel request from ${requester}.`,
userEmailNotFound: (email) => `Sorry, there is no user with email ${email} in the database.`,
userIdNotFound: (id) => `Sorry, there is no user with id: ${id} in the database.`,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected indentation of 2 spaces but found 4 indent

unauthorizedAccessToTravel: 'Access denied. Accessible only by travel requester or his/her line manager.',
unauthorizedCommentDelete: "comment can only be deleted by it's author",
successfullyApproval: (requester) => `You have successfully approved a travel request from ${requester}.`,
userEmailNotFound: (email) => `Sorry, there is no user with email ${email} in the database.`,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected indentation of 2 spaces but found 4 indent

unauthorized: 'Not authorized.',
unauthorizedAccessToTravel: 'Access denied. Accessible only by travel requester or his/her line manager.',
unauthorizedCommentDelete: "comment can only be deleted by it's author",
successfullyApproval: (requester) => `You have successfully approved a travel request from ${requester}.`,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected indentation of 2 spaces but found 4 indent

successComment: [
'You have successfully commented on a travel request.',
'You have successfully retrieved all comments for this travel request.',
],
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected indentation of 2 spaces but found 4 indent

// comment messages
successComment: [
'You have successfully commented on a travel request.',
'You have successfully retrieved all comments for this travel request.',
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected indentation of 4 spaces but found 8 indent

returnTripCreated: 'Your return trip request was created successfully.',
// comment messages
successComment: [
'You have successfully commented on a travel request.',
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected indentation of 4 spaces but found 8 indent

requestNotPending: 'This Travel Request is not Pending.',
returnTripCreated: 'Your return trip request was created successfully.',
// comment messages
successComment: [
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected indentation of 2 spaces but found 4 indent

nonExistentTravel: 'The travel request does not exist.',
requestNotPending: 'This Travel Request is not Pending.',
returnTripCreated: 'Your return trip request was created successfully.',
// comment messages
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected indentation of 2 spaces but found 4 indent

getFeedback: (accomm) => `You have successfully retrieved feedback on our accommodation facility with name, ${accomm}.`,
accommodationNotFound: 'The accommodation facility does not exist.',
invalidAccommodationId: 'The Accommodation ID must be an integer value.',
emptyFeedback: 'Feedback field cannot be empty.',
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected indentation of 2 spaces but found 4 indent

newFeedback: (accomm) => `You have successfully dropped a feedback on our accomodation facility with name, ${accomm}.`,
getFeedback: (accomm) => `You have successfully retrieved feedback on our accommodation facility with name, ${accomm}.`,
accommodationNotFound: 'The accommodation facility does not exist.',
invalidAccommodationId: 'The Accommodation ID must be an integer value.',
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected indentation of 2 spaces but found 4 indent


newFeedback: (accomm) => `You have successfully dropped a feedback on our accomodation facility with name, ${accomm}.`,
getFeedback: (accomm) => `You have successfully retrieved feedback on our accommodation facility with name, ${accomm}.`,
accommodationNotFound: 'The accommodation facility does not exist.',
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected indentation of 2 spaces but found 4 indent

wrongRole: (role) => `Sorry, you are not a/an ${role}.`,

newFeedback: (accomm) => `You have successfully dropped a feedback on our accomodation facility with name, ${accomm}.`,
getFeedback: (accomm) => `You have successfully retrieved feedback on our accommodation facility with name, ${accomm}.`,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected indentation of 2 spaces but found 4 indent

unregisteredEmail: (email) => `User with this email (${email}) not found in our database.`,
wrongRole: (role) => `Sorry, you are not a/an ${role}.`,

newFeedback: (accomm) => `You have successfully dropped a feedback on our accomodation facility with name, ${accomm}.`,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected indentation of 2 spaces but found 4 indent

invalidToken: 'Invalid Token, please login.',
invalidTravelType: 'Sorry you can only make return trip request here.',
invalidTravelId: 'The travel ID must be an integer value.',
invalidUserId: 'Sorry you can only create the request with the id of the logged in user.',
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected indentation of 2 spaces but found 4 indent

isNotISODate: "Your date must be of ISO8601 standard '2019-01-10'.",
invalidToken: 'Invalid Token, please login.',
invalidTravelType: 'Sorry you can only make return trip request here.',
invalidTravelId: 'The travel ID must be an integer value.',
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected indentation of 2 spaces but found 4 indent

isNotInteger: 'You must enter a valid integer type.',
isNotISODate: "Your date must be of ISO8601 standard '2019-01-10'.",
invalidToken: 'Invalid Token, please login.',
invalidTravelType: 'Sorry you can only make return trip request here.',
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected indentation of 2 spaces but found 4 indent

incorrectPassword: 'Sorry, the password entered is not correct.',
isNotInteger: 'You must enter a valid integer type.',
isNotISODate: "Your date must be of ISO8601 standard '2019-01-10'.",
invalidToken: 'Invalid Token, please login.',
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected indentation of 2 spaces but found 4 indent

lineManager: 'Line manager must be present to continue',
incorrectPassword: 'Sorry, the password entered is not correct.',
isNotInteger: 'You must enter a valid integer type.',
isNotISODate: "Your date must be of ISO8601 standard '2019-01-10'.",
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected indentation of 2 spaces but found 4 indent

notifyUser: 'Your travel request has been successfully created and it is awaiting approval',
lineManager: 'Line manager must be present to continue',
incorrectPassword: 'Sorry, the password entered is not correct.',
isNotInteger: 'You must enter a valid integer type.',
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected indentation of 2 spaces but found 4 indent

emptyTravelType: 'Sorry, travel type can not be empty.',
notifyUser: 'Your travel request has been successfully created and it is awaiting approval',
lineManager: 'Line manager must be present to continue',
incorrectPassword: 'Sorry, the password entered is not correct.',
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected indentation of 2 spaces but found 4 indent

emptyTravelPurpose: 'You must state your travel purpose',
emptyTravelType: 'Sorry, travel type can not be empty.',
notifyUser: 'Your travel request has been successfully created and it is awaiting approval',
lineManager: 'Line manager must be present to continue',
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected indentation of 2 spaces but found 4 indent

emptyReturnDate: 'You must state your return date',
emptyTravelPurpose: 'You must state your travel purpose',
emptyTravelType: 'Sorry, travel type can not be empty.',
notifyUser: 'Your travel request has been successfully created and it is awaiting approval',
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected indentation of 2 spaces but found 4 indent

emptyOrigin: 'You must state your current city.',
emptyReturnDate: 'You must state your return date',
emptyTravelPurpose: 'You must state your travel purpose',
emptyTravelType: 'Sorry, travel type can not be empty.',
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected indentation of 2 spaces but found 4 indent

emptyAccommodation: 'You must select an accommodation.',
emptyComment: 'comment cannot be empty.',
emptyDepartureDate: 'You must state your departure date',
emptyDestination: 'You must state your destination',
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected indentation of 2 spaces but found 4 indent

diffDepartment: 'You are not in the same department as the Travel Requester.',
emptyAccommodation: 'You must select an accommodation.',
emptyComment: 'comment cannot be empty.',
emptyDepartureDate: 'You must state your departure date',
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected indentation of 2 spaces but found 4 indent

deleteComment: 'Comment successfully deleted.',
diffDepartment: 'You are not in the same department as the Travel Requester.',
emptyAccommodation: 'You must select an accommodation.',
emptyComment: 'comment cannot be empty.',
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected indentation of 2 spaces but found 4 indent

dateForToday: "Please your departure date must be equal to or greater than today's date.",
deleteComment: 'Comment successfully deleted.',
diffDepartment: 'You are not in the same department as the Travel Requester.',
emptyAccommodation: 'You must select an accommodation.',
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected indentation of 2 spaces but found 4 indent

dateForFuture: 'Please enter a date greater than the departure date for return date.',
dateForToday: "Please your departure date must be equal to or greater than today's date.",
deleteComment: 'Comment successfully deleted.',
diffDepartment: 'You are not in the same department as the Travel Requester.',
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected indentation of 2 spaces but found 4 indent

@ChidiChuks ChidiChuks force-pushed the ft-notify-new-travel-167730641 branch from 5c6dd8e to eeda180 Compare September 14, 2019 22:55
commentNotFound: 'The comment does not exist.',
dateForFuture: 'Please enter a date greater than the departure date for return date.',
dateForToday: "Please your departure date must be equal to or greater than today's date.",
deleteComment: 'Comment successfully deleted.',
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected indentation of 2 spaces but found 4 indent

noDigitInPassword: 'Password must contain at least one digit.',
commentNotFound: 'The comment does not exist.',
dateForFuture: 'Please enter a date greater than the departure date for return date.',
dateForToday: "Please your departure date must be equal to or greater than today's date.",
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected indentation of 2 spaces but found 4 indent

shortPassword: 'The length of the password must be 8 and above.',
noDigitInPassword: 'Password must contain at least one digit.',
commentNotFound: 'The comment does not exist.',
dateForFuture: 'Please enter a date greater than the departure date for return date.',
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected indentation of 2 spaces but found 4 indent

usedEmail: (email) => `User with this email (${email}) already exist.`,
shortPassword: 'The length of the password must be 8 and above.',
noDigitInPassword: 'Password must contain at least one digit.',
commentNotFound: 'The comment does not exist.',
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected indentation of 2 spaces but found 4 indent

invalidEmail: 'Please, enter a valid email address.',
usedEmail: (email) => `User with this email (${email}) already exist.`,
shortPassword: 'The length of the password must be 8 and above.',
noDigitInPassword: 'Password must contain at least one digit.',
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected indentation of 2 spaces but found 4 indent

managerApproval: (pendingReq) => `You have ${pendingReq} requests requiring your approval`,
managerNotFound: "Manager's detail missing",
requestNotOpen: 'Your request is no longer open for editing.',
requestUpdated: 'Your request has been successfully updated',
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected indentation of 2 spaces but found 4 indent

oneWayTripCreated: 'Your request has been successfully created',
managerApproval: (pendingReq) => `You have ${pendingReq} requests requiring your approval`,
managerNotFound: "Manager's detail missing",
requestNotOpen: 'Your request is no longer open for editing.',
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected indentation of 2 spaces but found 4 indent

// Travel requests messages
oneWayTripCreated: 'Your request has been successfully created',
managerApproval: (pendingReq) => `You have ${pendingReq} requests requiring your approval`,
managerNotFound: "Manager's detail missing",
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected indentation of 2 spaces but found 4 indent

signupSuccess: (email) => `You have successfully registered with this email, ${email}.`,
// Travel requests messages
oneWayTripCreated: 'Your request has been successfully created',
managerApproval: (pendingReq) => `You have ${pendingReq} requests requiring your approval`,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected indentation of 2 spaces but found 4 indent

welcome: 'Welcome to Archangel Barefoot Nomad Web App API.',
signupSuccess: (email) => `You have successfully registered with this email, ${email}.`,
// Travel requests messages
oneWayTripCreated: 'Your request has been successfully created',
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected indentation of 2 spaces but found 4 indent

@@ -37,6 +38,8 @@ export default {
emptyReturnDate: 'You must state your return date',
emptyTravelPurpose: 'You must state your travel purpose',
emptyTravelType: 'Sorry, travel type can not be empty.',
notifyUser: 'Your travel request has been successfully created and it is awaiting approval',
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected indentation of 2 spaces but found 0 indent

@danoseun danoseun self-requested a review September 17, 2019 10:40
inputting pusher trigger
@ChidiChuks ChidiChuks force-pushed the ft-notify-new-travel-167730641 branch from 0396070 to ae666f1 Compare September 17, 2019 17:08
});
const notificationMessage = notificationObj.dataValues;

console.log(notificationMessage);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unexpected console statement no-console

)
});
const notificationMessage = notificationObj.dataValues;

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trailing spaces not allowed no-trailing-spaces

travel_id: data.dataValues.id,
message: message.notificationReturnMessage(
first_name, data.dataValues.origin
)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unexpected newline before ')' function-paren-newline

recipient_id: dept.manager_user_id,
travel_id: data.dataValues.id,
message: message.notificationReturnMessage(
first_name, data.dataValues.origin
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'data' is not defined no-undef

const notificationObj = await createNotification({
recipient_id: dept.manager_user_id,
travel_id: data.dataValues.id,
message: message.notificationReturnMessage(
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unexpected newline after '(' function-paren-newline


delete notificationMessage.recipient_id;
notificationMessage.title = 'New Travel Request.';
console.log(`new-travel-${dept.manager_user_id}`)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing semicolon semi
Unexpected console statement no-console

});
const notificationMessage = notificationObj.dataValues;

console.log(notificationMessage);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unexpected console statement no-console

travel_id: data.dataValues.id,
message: message.notificationTravelMessage(
first_name, data.dataValues.origin
)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unexpected newline before ')' function-paren-newline

const notificationObj = await createNotification({
recipient_id: dept.manager_user_id,
travel_id: data.dataValues.id,
message: message.notificationTravelMessage(
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unexpected newline after '(' function-paren-newline

@@ -31,6 +33,29 @@ const createOneWayTrip = async(req, res) => {
dept_id,
});

const dept = await getADepartment(dept_id);

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trailing spaces not allowed no-trailing-spaces

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants